﻿using System;
using UnityEngine;
using UnityEngine.Events;
using UnityEngine.UI;

namespace UnityGameUI
{
	// Token: 0x02000007 RID: 7
	public static class UINavigation
	{
		// Token: 0x06000032 RID: 50 RVA: 0x00003864 File Offset: 0x00001A64
		public static void Initialize(Navigation[] nav, GameObject panel)
		{
			UINavigation.navigations = nav;
			UINavigation.panel = panel;
			UINavigation.elementX = (int)(-panel.GetComponent<RectTransform>().rect.width / 2f + 60f);
			UINavigation.elementY = (int)(panel.GetComponent<RectTransform>().rect.height / 2f - 20f);
			UINavigation.CreateNavigation();
		}

		// Token: 0x06000033 RID: 51 RVA: 0x000038D0 File Offset: 0x00001AD0
		public static void CreateNavigation()
		{
			foreach (Navigation item in UINavigation.navigations)
			{
				string backgroundColor = "#616161FF";
				Vector3 localPosition = new Vector3((float)UINavigation.elementX, (float)UINavigation.elementY, 0f);
				GameObject gameObject = UIControls.createUIButton(UINavigation.panel, backgroundColor, item.button, new UnityAction(item.SetActive), localPosition);
				gameObject.GetComponent<RectTransform>().sizeDelta = new Vector2(120f, 30f);
				gameObject.GetComponentInChildren<Text>().color = new Color(255f, 255f, 255f, 1f);
				item.SetActive(item.show);
				UINavigation.elementY -= 30;
			}
		}

		// Token: 0x06000034 RID: 52 RVA: 0x00003990 File Offset: 0x00001B90
		public static void SetActive(this Navigation nav)
		{
			foreach (Navigation i in UINavigation.navigations)
			{
				if (i == nav)
				{
					i.SetActive(true);
				}
				else
				{
					i.SetActive(false);
				}
			}
		}

		// Token: 0x0400000F RID: 15
		public static GameObject panel;

		// Token: 0x04000010 RID: 16
		private static Navigation[] navigations;

		// Token: 0x04000011 RID: 17
		private static int elementX;

		// Token: 0x04000012 RID: 18
		private static int elementY;
	}
}
